package com.haoze.common.utils;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 树形数据信息。
 * @author zj
 * @time 2018-04-27。
 */
public class Tree<T> {
	/**
	 * 节点ID
	 */
	private String id;
	/**
	 * 显示节点文本
	 */
	private String text;
	private String onlyId;
	private String varCode;
	/**
	 * 显示节点文本
	 */
	private String elementName;
	/**
	 * 节点状态，open closed
	 */
	private Map<String, Object> state;
	/**
	 * 节点是否被选中 true false
	 */
	private boolean checked = false;
	/**
	 * 节点属性
	 */
	private Map<String, Object> attributes;

	/**
	 * 子节点
	 */
	private List<Tree<T>> children = new ArrayList();

	/**
	 * 子节点
	 */
	private List<Tree<T>> option = new ArrayList();

	/**
	 * 父ID
	 */
	private String parentId;

	private String sortNo;

	private String elementId;
	private String elementValue;

	private String type;//1-目录，2-术语

	private String pyCode;

	private Integer maxValue;

	private Integer minValue;
	private String elementUnit;
	private String dataSetId;
	private String tplDetailId;

	private String medicalType;//术语类型 1:字符串2:数字3:日期类型4:数据组 5:勾选项 6:单项选择7:多项选择 20：术语 21：值域 22：字典
	private String elementType;//数据元数据类型 1:字符串2:数字3:日期类型4:数据组 5:勾选项 6单项选择 7多项选择
	private Boolean disabled;
	private String emrType;
	private String templateType;
	private String canClick;
	/**
	 * 是否有父节点
	 */
	private boolean hasParent = false;
	/**
	 * 是否有子节点
	 */
	private boolean hasChildren = false;

	private String rootId;//根节点

	private String createNum;//可创建数量1：只能创建一份 2：能创建多份
	private String isWebView;//是否以网页方式打开1：是 0：否

	private boolean expand;
	private String elementFormat;

	private String ctlName;
	private String tplId;
	private String elementPropertyFormat;
	private String isShowAuthority;

	public String getElementType() {
		return elementType;
	}

	public void setElementType(String elementType) {
		this.elementType = elementType;
	}

	public String getMedicalType() {
		return medicalType;
	}

	public void setMedicalType(String medicalType) {
		this.medicalType = medicalType;
	}

	public String getIsWebView() {
		return isWebView;
	}

	public void setIsWebView(String isWebView) {
		this.isWebView = isWebView;
	}

	public String getCreateNum() {
		return createNum;
	}

	public void setCreateNum(String createNum) {
		this.createNum = createNum;
	}

	public String getRootId() {
		return rootId;
	}

	public void setRootId(String rootId) {
		this.rootId = rootId;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Boolean getDisabled() {
		return disabled;
	}

	public void setDisabled(Boolean disabled) {
		this.disabled = disabled;
	}

	public Map<String, Object> getState() {
		return state;
	}

	public void setState(Map<String, Object> state) {
		this.state = state;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public Map<String, Object> getAttributes() {
		return attributes;
	}

	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}

	public List<Tree<T>> getChildren() {
		return children;
	}

	public void setChildren(List<Tree<T>> children) {
		this.children = children;
	}

	public List<Tree<T>> getOption() {
		return option;
	}

	public void setOption(List<Tree<T>> option) {
		this.option = option;
	}

	public boolean isHasParent() {
		return hasParent;
	}

	public void setHasParent(boolean isParent) {
		this.hasParent = isParent;
	}

	public boolean isHasChildren() {
		return hasChildren;
	}

	public void setChildren(boolean isChildren) {
		this.hasChildren = isChildren;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getSortNo() {
		return sortNo;
	}

	public void setSortNo(String sortNo) {
		this.sortNo = sortNo;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getPyCode() {
		return pyCode;
	}

	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}

	public Integer getMaxValue() {
		return maxValue;
	}

	public String getElementId() {
		return elementId;
	}

	public void setElementId(String elementId) {
		this.elementId = elementId;
	}

	public void setMaxValue(Integer maxValue) {
		this.maxValue = maxValue;
	}

	public Integer getMinValue() {
		return minValue;
	}

	public void setMinValue(Integer minValue) {
		this.minValue = minValue;
	}

	public void setHasChildren(boolean hasChildren) {
		this.hasChildren = hasChildren;
	}

	public Tree(String id, String text,Boolean disabled ,Map<String, Object> state, boolean checked, Map<String, Object> attributes,
				List<Tree<T>> children, boolean isParent, boolean isChildren, String parentID,String tplId) {
		super();
		this.id = id;
		this.text = text;
		this.disabled = disabled;
		this.state = state;
		this.checked = checked;
		this.attributes = attributes;
		this.children = children;
		this.hasParent = isParent;
		this.hasChildren = isChildren;
		this.parentId = parentID;
		this.tplId = tplId;
	}

	public Tree() {
		super();
	}

	@Override
	public String toString() {

		return JSON.toJSONString(this);
	}

	public String getElementValue() {
		return elementValue;
	}

	public void setElementValue(String elementValue) {
		this.elementValue = elementValue;
	}

	public String getElementUnit() {
		return elementUnit;
	}

	public void setElementUnit(String elementUnit) {
		this.elementUnit = elementUnit;
	}

	public String getDataSetId() {
		return dataSetId;
	}

	public void setDataSetId(String dataSetId) {
		this.dataSetId = dataSetId;
	}

	public String getElementName() {
		return elementName;
	}

	public void setElementName(String elementName) {
		this.elementName = elementName;
	}

	public String getTplDetailId() {
		return tplDetailId;
	}

	public void setTplDetailId(String tplDetailId) {
		this.tplDetailId = tplDetailId;
	}

	public String getOnlyId() {
		return onlyId;
	}

	public void setOnlyId(String onlyId) {
		this.onlyId = onlyId;
	}

	public boolean isExpand() {
		return expand;
	}

	public void setExpand(boolean expand) {
		this.expand = expand;
	}

	public String getVarCode() {
		return varCode;
	}

	public void setVarCode(String varCode) {
		this.varCode = varCode;
	}

    public void setElementFormat(String elementFormat) {
        this.elementFormat = elementFormat;
    }

    public String getElementFormat() {
        return elementFormat;
    }

	public String getEmrType() {
		return emrType;
	}

	public void setEmrType(String emrType) {
		this.emrType = emrType;
	}

	public String getTemplateType() {
		return templateType;
	}

	public void setTemplateType(String templateType) {
		this.templateType = templateType;
	}

	public String getCtlName() {
		return ctlName;
	}

	public void setCtlName(String ctlName) {
		this.ctlName = ctlName;
	}

	public String getElementPropertyFormat() {
		return elementPropertyFormat;
	}

	public void setElementPropertyFormat(String elementPropertyFormat) {
		this.elementPropertyFormat = elementPropertyFormat;
	}

	public String getCanClick() {
		return canClick;
	}

	public void setCanClick(String canClick) {
		this.canClick = canClick;
	}

	public String getTplId() {
		return tplId;
	}

	public void setTplId(String tplId) {
		this.tplId = tplId;
	}

	public String getIsShowAuthority() {
		return isShowAuthority;
	}

	public void setIsShowAuthority(String isShowAuthority) {
		this.isShowAuthority = isShowAuthority;
	}
}